////////////////////////////////////////////////////////////////////////////
//
//  Crytek Engine Source File.
//  Copyright (C), Crytek Studios, 2010.
// -------------------------------------------------------------------------
//  File name:   environemenprobeobject.h
//  Version:     v1.00
//  Created:     30/3/2010 by Johnmichael.
//  Compilers:   Visual Studio.NET
//  Description: 
// -------------------------------------------------------------------------
//  History:
//
////////////////////////////////////////////////////////////////////////////

#ifndef __environmentprobeobject_h__
#define __environmentprobeobject_h__

#if _MSC_VER > 1000
#pragma once
#endif

#include "EntityObject.h"

/*!
 *	CEnvironmentProbeObject is an object that represent an environment map generator
 *	also it encapsulates a light
 */

class CEnvironmentProbePanel;
struct IMaterial;

class CEnvironementProbeObject : public CEntityObject
{
public:
	DECLARE_DYNCREATE(CEnvironementProbeObject)

	//////////////////////////////////////////////////////////////////////////
	// Ovverides from CBaseObject.
	//////////////////////////////////////////////////////////////////////////
	bool Init( IEditor *ie, CBaseObject *prev, const CString &file );
	void InitVariables();
	void Serialize( CObjectArchive &ar );
	void BeginEditParams( IEditor *ie,int flags );
	void EndEditParams( IEditor *ie );
	void Display( DisplayContext &dc );
	void GetBoundBox( AABB &box );
	void GetLocalBounds(AABB &aabb);
	void GenerateCubemap();
	void OnPreviewCubemap(IVariable *	piVariable);
	void OnCubemapResolutionChange(IVariable *	piVariable);
	IMaterial * CreateMaterial();
  void UpdateLinks();

  int AddEntityLink( const CString &name,GUID targetEntityId,const Quat& relRot,const Vec3& relPos );
  void OnPropertyChanged( IVariable * pVar );
  void OnMultiSelPropertyChanged( IVariable * pVar );

protected:
	//! Dtor must be protected.
	CEnvironementProbeObject();

private:

	static CEnvironmentProbePanel * s_pProbePanel;
	static int s_panelProbeID;

	CSmartVariable<bool> m_preview_cubemap;
	CSmartVariableEnum<int> m_cubemap_resolution;
};

/*!
 * Class Description of EnvironmentProbeObject.	
 */
class CEnvironmentProbeObjectClassDesc : public CObjectClassDesc
{
public:
	REFGUID ClassID()
	{
		// {77048AAA-02A4-4a98-AAD4-71A0EBA659EE}
		static const GUID guid = { 0x77048aaa, 0x2a4, 0x4a98, { 0xaa, 0xd4, 0x71, 0xa0, 0xeb, 0xa6, 0x59, 0xee } };
		return guid;
	}
	ObjectType GetObjectType() { return OBJTYPE_ENTITY; };
	const char* ClassName() { return "EnvironmentProbe"; };
	const char* Category() { return "Misc"; };
	CRuntimeClass* GetRuntimeClass() { return RUNTIME_CLASS(CEnvironementProbeObject); };
	int GameCreationOrder() { return 202; };
	const char * GetTextureIcon() { return "Editor/ObjectIcons/environmentProbe.bmp"; };
};

#endif // __environmentprobeobject_h__
